const Sequelize = require("sequelize");
const { DataTypes } = require("sequelize");

const sequelize = new Sequelize("exam1", "root", "123456", {
    host: "localhost",
    dialect: "mysql",
});

const User = sequelize.define("User", {
    username: DataTypes.STRING,
    password: DataTypes.STRING,
});
const UserInfo = sequelize.define("UserInfo", {
    nikename: DataTypes.STRING,
    desc: DataTypes.STRING,
    gender: DataTypes.INTEGER,
});

User.hasOne(UserInfo, {
    onDelete: "CASCADE",
    onUpdate: "CASCADE",
});
UserInfo.belongsTo(User);
module.exports = {
    User,
    UserInfo,
};
